package cn.xie.blog.model.common.enums.response;

import cn.xie.blog.model.common.BaseCode.BaseCode;

/**
 * @author: xiaoxie
 * create: 2025-04-21 20:52
 * @BelongsProject: blog-parent
 * @BelongsPackage: cn.xie.blog.model.common.enums
 * description: 回复的返回码枚举
 */
public enum ResponseCodeEnum implements BaseCode {

    //通用返回码
    SUCCESS(10000, "成功"),
    PARAM_ERROR(10001, "请求参数错误"),
    UNAUTHORIZED(10002, "未授权，身份验证失败"),
    FORBIDDEN(10003, "没有权限访问该资源"),
    NOT_FOUND(10004, "请求的资源不存在"),
    SERVER_ERROR(10005, "服务器内部错误"),
    ARGUMENT_VALID_ERROR(10006, "参数校验异常"),
    LOGIN_AUTH(10008, "未登陆或登录状态已过期,请重新登录"),
    USERNAME_EXISTED(10009,"该用户名已存在,请重新设置"),
    EMAIL_EXISTED(10009,"该邮箱已存在,请重新设置"),

    //登录相关
    ACCOUNT_OR_PASSWORD_ERROR(20001, "账号或密码错误"),
    ACCOUNT_NOT_ACTIVATED(20002, "账号未激活"),
    ACCOUNT_LOCKED(20003, "账号被锁定"),
    THIRD_PARTY_LOGIN_FAILED(20004, "第三方登录失败"),
    MAIL_CODE_ERROR(20005,"邮件发送失败"),
    ACCOUNT_NOT_REGISTERED(20006,"账号未注册"),
    CODE_ERROR(20007,"验证码输入错误或超时"),
    TOKEN_EXIST(20008,"Token 已过期"),
    TOKEN_ERROR(20009,"Token 校验失败"),
    //数据管理相
    DATA_NOT_FOUND(30001, "数据不存在"),
    DATA_OPERATION_FAILED(30002, "数据操作失败"),
    DATA_FORMAT_ERROR(30003, "数据格式错误"),

    //博客相关
    BLOG_CONTENT_EMPTY(40001, "博客内容为空"),
    BLOG_CATEGORY_OR_TAG_NOT_EXIST(40002, "博客分类或标签不存在"),
    NO_PERMISSION_FOR_BLOG_OPERATION(40003, "无权限操作博客"),

    //私信相关
    MESSAGE_CONTENT_EMPTY(50001, "私信内容为空"),
    NO_PERMISSION_TO_SEND_MESSAGE(50002, "无权限发送私信"),

    //搜索相关
    SEARCH_KEYWORD_EMPTY(60001, "搜索关键词为空"),
    SEARCH_CONDITION_INVALID(60002, "搜索条件不合法"),

    //公告相关
    ANNOUNCEMENT_CONTENT_EMPTY(70001, "公告内容为空"),
    NO_PERMISSION_FOR_ANNOUNCEMENT_OPERATION(70002, "无权限操作公告"),

    //排行榜相关
    RANKING_TYPE_ERROR(80001, "排行榜类型错误"),

    //审核相关
    NO_PERMISSION_TO_REVIEW(90001, "无权限审核"),
    REVIEW_PASSED(90002, "审核通过"),
    REVIEW_REJECTED(90003, "审核拒绝"),

    //日志相关
    LOG_QUERY_CONDITION_INVALID(100001, "日志查询条件不合法"),
    LOG_EXPORT_FAILED(100002, "日志导出失败"),

    //学习目标与进度相关
    LEARNING_GOAL_FORMAT_ERROR(110001, "学习目标格式错误"),
    LEARNING_TIME_RECORD_FAILED(110002, "学习时长记录失败"),

    //学习资源管理相关
    RESOURCE_FORMAT_UNSUPPORTED(120001, "学习资源格式不支持"),
    RESOURCE_SIZE_EXCEEDED(120002, "学习资源大小超出限制"),
    NO_PERMISSION_TO_ACCESS_RESOURCE(120003, "无权限访问学习资源"),

    //学习统计相关
    STATISTICS_DATE_RANGE_INVALID(130001, "统计日期范围不合法"),

    //用户关系与动态相关
    DYNAMIC_CONTENT_EMPTY(140001, "动态内容为空"),
    NO_PERMISSION_TO_OPERATE_DYNAMIC(140002, "无权限操作动态"),

    MAIL_SEND_FAILED(1400003, "邮件发送失败,请重试"),

    SYSTEM_ERROR(500000,"服务内部错误,请重试");


    private final Integer code;
    private final String message;

    ResponseCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
